/**
 * 
 */
package be.luys.almacen.gui.logic;

import java.util.HashSet;
import java.util.Set;

/**
 * @author fks/Erik Luys
 */
public final class ApplicationManager
{
    private static ApplicationManager instance;

    public static ApplicationManager getManager()
    {
        if (instance == null)
        {
            instance = new ApplicationManager();
        }
        return instance;
    }

    private final Set<LoadingListener> loadingListeners = new HashSet<LoadingListener>();

    public void register(final LoadingListener listener)
    {
        if (!this.loadingListeners.contains(listener))
        {
            this.loadingListeners.add(listener);
        }
    }

    // ===========================================================================
    /**
     * @param object
     * @param text
     * @param progres
     */
    public void loading(Object object, String text, double progres)
    {
        for (LoadingListener l : loadingListeners)
        {
            l.loading(text, progres);
        }
    }

}
